﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Mbl.ParameterizedTest.AcceptanceTests.CalculatorTests;

namespace Mbl.ParameterizedTest.AcceptanceTests.IntTests
{
    [TestClass]
    public class ComparisonTests
    {
        [TestMethod]
        [ExpectedFailedTestCases(2, 3)]
        public void Greater_than_tests()
        {
            var calculator = new Calculator();

            ParameterizedTest
                .For<int, int>((a, b) => calculator.Add(a, b))
                .Given(2, 2).ExpectGreaterThan(3).Because("It's right")
                .Given(2, 2).ExpectGreaterThan(4).Because("It's wrong")
                .Given(2, 2).ExpectGreaterThan(5).Because("It's wrong.")                
                .Evaluate();
        }

        [TestMethod]
        [ExpectedFailedTestCases(2, 3)]
        public void Less_than_tests()
        {
            var calculator = new Calculator();

            ParameterizedTest
                .For<int, int>((a, b) => calculator.Add(a, b))
                .Given(2, 2).ExpectLessThan(5).Because("It's right")
                .Given(2, 2).ExpectGreaterThan(4).Because("It's wrong")
                .Given(2, 2).ExpectLessThan(3).Because("It's wrong.")
                .Evaluate();
        }

        [TestMethod]
        [ExpectedFailedTestCases(2)]
        public void Equality_tests()
        {
            var calculator = new Calculator();

            ParameterizedTest
                .For<int, int>((a, b) => calculator.Add(a, b))
                .Given(2, 2).Expect(4).Because("It's right")
                .Given(2, 2).Expect(5).Because("It's wrong")                
                .Evaluate();
        }

        [TestMethod]
        [ExpectedFailedTestCases(1)]
        public void Null_tests()
        {
            var calculator = new Calculator();

            ParameterizedTest
                .For<int, int>((a, b) => calculator.Add(a, b))
                .Given(2, 2).ExpectNull().Because("Null check is currently not hidden for structs")                
                .Evaluate();
        }

    }
}
